package middleware.llvm.value;

import java.util.ArrayList;
import java.util.List;

/**
 * IR 类型基类
 *
 * @author 杨凯伟
 * @date 2024/10/30
 */
public abstract class IRType implements Cloneable {
    private int ptrNum = 0;

    public IRType ptr(int num) {
        this.ptrNum = num;
        return this;
    }

    public int getPtrNum() {
        return ptrNum;
    }

    public static BasicIRType getInt() {
        return new BasicIRType(middleware.llvm.enums.IRType.INT);
    }

    public static BasicIRType getVoid() {
        return new BasicIRType(middleware.llvm.enums.IRType.VOID);
    }

    public static BasicIRType getChar() {
        return new BasicIRType(middleware.llvm.enums.IRType.CHAR);
    }
    public static BasicIRType getBool() {
        return new BasicIRType(middleware.llvm.enums.IRType.BOOL);
    }

    public List<Integer> getArrayDims() {
        return new ArrayList<>();
    }

    public abstract String initValsToString(List<Integer> initVals);
    public abstract middleware.llvm.enums.IRType getType();
    @Override
    public abstract IRType clone();
}
